//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类.demo_1656;

import java.util.ArrayList;
import java.util.List;

public class OrderedStream {
    int[] id;
    String[] values;
    int ptr = 0;

    public OrderedStream(int n) {
        this.id = new int[n];
        this.values = new String[n];
    }

    public List<String> insert(int idKey, String value) {
        List<String> list = new ArrayList();
        this.id[idKey - 1] = 1;

        for(this.values[idKey - 1] = value; this.ptr < this.id.length && this.id[this.ptr] == 1; ++this.ptr) {
            list.add(this.values[this.ptr]);
        }

        return list;
    }
}
